package cn.edu.nsmc.modules.sys.controller;

import cn.edu.nsmc.common.utils.R;
import cn.edu.nsmc.modules.sys.entity.SysDepartmentEntity;
import cn.edu.nsmc.modules.sys.form.DepartmentList;
import cn.edu.nsmc.modules.sys.service.SysDepartmentService;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author ZY
 * @Date 2024/2/19 20:17
 */
@RestController
@RequestMapping("/sys/department")
public class SysDepartmentController extends AbstractController{
    @Resource
    SysDepartmentService sysDepartmentService;

    @PostMapping("addDepartment")
    private R addDepartment(@RequestBody SysDepartmentEntity sysDepartmentEntity){
        return sysDepartmentService.addDepartment(sysDepartmentEntity);
    }

    @PutMapping("updateDepartment")
    private R updateDepartment(@RequestBody SysDepartmentEntity sysDepartmentEntity){
        return sysDepartmentService.updateDepartment(sysDepartmentEntity);
    }
    @GetMapping("getDepartmentById/{id}")
    private R getDepartmentById(@PathVariable Long id){
        return sysDepartmentService.getDepartmentById(id);
    }
    @PostMapping("getDepartmentList")
    private R getDepartmentList(@RequestBody DepartmentList departmentList){
        return sysDepartmentService.getDepartmentList(departmentList);
    }
    @PutMapping("deleteDepartmentByIds")
    private R deleteDepartmentByIds(@RequestParam("ids")  String[] ids){
        return sysDepartmentService.deleteDepartmentByIds(ids);
    }
    @DeleteMapping("deleteDepartmentById/{id}")
    private R deleteDepartmentById(@PathVariable Long id) {
        return sysDepartmentService.deleteDepartmentById(id);
    }
}
